package main

import (
	"fmt"
	"math"
)

func main() {
	//example1()
	example2()

}

func example1() {
	for i := 2; i <= 100; i++ {
		if justify(i) == true {
			fmt.Printf("%v is 质数\n", i)
		}
	}
}

func justify(n int) bool {
	if n < 2 {
		return false
	}
	for i := 2; i < n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return true
}

func example2() {
	for i := 100; i < 1000; i++ {
		if is_shuixianhua(i) == true {
			fmt.Printf("i=%v\n", i)
		}
	}
}

func is_shuixianhua(n int) bool {
	one := float64(n % 10)
	two := float64((n / 10) % 10)
	three := float64((n / 100) % 10)
	if math.Pow(one, 3)+math.Pow(two, 3)+math.Pow(three, 3) == float64(n) {
		return true
	}
	return false
}
